<template>
	<view>
		<z-paging ref="paging" v-model="list" @query="getPage" :auto="false">
			<cu-custom slot="top" :bgColor="'bg-'+ theme.themeColor" :isBack="true">
				<block slot="backText">返回</block>
				<block slot="content">我的团队</block>
			</cu-custom>
			<view class="cu-list menu-avatar margin-sm">
				<view class="cu-item padding solid-bottom" v-for="(item,index) in list" :key="index">
					<view class="cu-avatar round head flex" :style="'background-image:url(' + item.avatarUrl + ')'">
						<view class="content">
							<view class="text-black">{{item.nickName}}</view>
						</view>
					</view>
				</view>
			</view>
		</z-paging>
	</view>
</template>

<script>
	import {
		getPage as getDistributionUserPage
	} from '@/api/userinfo.js';
	export default {
		data() {
			return {
				theme: getApp().globalData.theme,
				list: [],
				userInfo: {}
			}
		},
		onLoad() {
			this.userInfo = uni.getStorageSync('user_info');
			getApp().initPage().then(res => {
				this.$nextTick(function() {
					this.$refs.paging.reload();
				})
			})
		},
		methods: {
			/**
			 * 分页查询
			 */
			getPage(pageNo, pageSize) {
				getDistributionUserPage({
					current: pageNo,
					size: pageSize,
					descs: 'create_time',
					parentId: this.userInfo.id,
				}).then(res => {
					this.$refs.paging.complete(res.data.records);
				});
			}
		}
	}
</script>

<style>
</style>
